/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.game.math.view.action;

import java.awt.Component;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.SwingUtilities;
import org.game.math.view.config.Configure;
import org.game.math.view.SettingDialog;
import java.util.ResourceBundle;

/**
 *
 * @author nmduc
 */
class PreferenceAction(name:String) extends AbstractAction(name){
    def this() = {
      this(PreferenceAction.bundle.getString("item.menu.name"));
    }

    override def actionPerformed(ae:ActionEvent):Unit = {
        Configure.getInstance().initializeTempProperties();
        val frame:Frame  = SwingUtilities.getRoot(ae.getSource().asInstanceOf[Component]).asInstanceOf[Frame];
        val dialog:SettingDialog = new SettingDialog(frame, true);
        dialog.setLocationRelativeTo(frame);
        dialog.setVisible(true);
    }
}

object PreferenceAction {
    private val bundle:ResourceBundle = ResourceBundle.getBundle("org.game.math.view.action.PreferenceAction");
}